 <!-- 订单项目明细表表单弹窗 -->
<form id="orderitems-form" lay-filter="orderitems-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">订单ID</label>
        <div class="layui-input-block">
            <input name="orderId" placeholder="请输入订单ID" type="text" class="layui-input" maxlength="20"  id="orderId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">项目类型，0-咨询，1-闪测，2-提问,3-充值</label>
        <div class="layui-input-block">
            <input name="itemType" placeholder="请输入项目类型，0-咨询，1-闪测，2-提问,3-充值" type="text" class="layui-input layui-hide" maxlength="20"  id="itemType"
                   lay-verify="required" required/>
            <input name="strItemType" type="text" class="layui-input" maxlength="20"  id="strItemType"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">项目ID</label>
        <div class="layui-input-block">
            <input name="itemId" placeholder="请输入项目ID，初期只有闪问的问题ID，其他类型的项目留空" type="text" class="layui-input" maxlength="20"  id="itemId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">项目名称</label>
        <div class="layui-input-block">
            <input name="itemName" placeholder="请输入项目名称" type="text" class="layui-input" maxlength="20"  id="itemName"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">项目图片</label>-->
        <!--<div class="layui-input-block">-->
            <!--<input name="image" placeholder="请输入项目图片" type="text" class="layui-input" maxlength="20"  id="image"-->
                   <!--lay-verify="required" required/>-->
        <!--</div>-->
    <!--</div>-->
 		    <div class="layui-form-item">
        <label class="layui-form-label">项目描述</label>
        <div class="layui-input-block">
            <input name="description" placeholder="请输入项目描述" type="text" class="layui-input" maxlength="20"  id="description"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">项目原价</label>
        <div class="layui-input-block">
            <input name="originalPrice" placeholder="请输入项目原价" type="text" class="layui-input" maxlength="20"  id="originalPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">折扣价</label>
        <div class="layui-input-block">
            <input name="discountPrice" placeholder="请输入折扣价" type="text" class="layui-input" maxlength="20"  id="discountPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">减免金额</label>
        <div class="layui-input-block">
            <input name="reductionPrice" placeholder="请输入减免金额" type="text" class="layui-input" maxlength="20"  id="reductionPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">支付价格</label>
        <div class="layui-input-block">
            <input name="actualPrice" placeholder="请输入支付价格" type="text" class="layui-input" maxlength="20"  id="actualPrice"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">售卖数量</label>
        <div class="layui-input-block">
            <input name="quantity" placeholder="请输入售卖数量" type="text" class="layui-input" maxlength="20"  id="quantity"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <!--<input name="createDate" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createDate"-->
                   <!--lay-verify="required"  required/>-->
            <label class="layui-form-label" style="width: 180px;text-align: left;" name="createDate"  id="createDate"></label>
        </div>
    </div>
 		    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">八字所属人ID</label>-->
        <!--<div class="layui-input-block">-->
            <!--<input name="birthId" placeholder="请输入八字所属人ID" type="text" class="layui-input" maxlength="20"  id="birthId"-->
                   <!--lay-verify="required" required/>-->
        <!--</div>-->
    <!--</div>-->
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <!--<button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>-->
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;

        var orderitems = admin.getTempData('t_orderitems');
        console.log(orderitems);
           if (orderitems.method=="update"){
               if(orderitems.itemType==0){
                orderitems.strItemType = '咨询';
               }else if(orderitems.itemType==1){
                   orderitems.strItemType = '闪测';
               }else if(orderitems.itemType==2){
                   orderitems.strItemType = '提问';
               }else if(orderitems.itemType==3){
                   orderitems.strItemType = '充值';
               }else if(orderitems.itemType==4){
                   orderitems.strItemType = 'VIP认证';
               }
               $("#createDate").text(orderitems.createDate);
        	form.val('orderitems-form', orderitems);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('order/orderitems/'+orderitems.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
